package com.abbas.CayTcore.model

import com.abbas.CayTcore.base.BaseModel
import com.abbas.CayTcore.base.CommCallback
import com.abbas.CayTcore.entity.vo.InfoVO
import com.abbas.CayTcore.entity.vo.ScheduleVO
import com.abbas.CayTcore.start

class WindingHomeUplevelModel : BaseModel() {

    /**
     * 获取提示
     */
    fun getInfo(commCallback: CommCallback<InfoVO>.() -> Unit){
        val callback = CommCallback<InfoVO>().apply(commCallback)
        api.getAllInfo().start {
            onSuccess {
                callback.onSuccess?.invoke(it)
            }

            onRequestError {
                callback.onNetError?.invoke(it)
            }
        }
    }

    fun getSchedule(departmentId: Int,jobId: Int,commCallback: CommCallback<ScheduleVO>.() -> Unit){
        val callback = CommCallback<ScheduleVO>().also(commCallback)
        api.getNowProduct(departmentId,jobId).start {
            onSuccess{
                callback.onSuccess?.invoke(it)
            }
        }
    }
}